import request from '@/utils/request'
const prefixUrl = process.env.VUE_APP_SUPERSET_SERVER
/**
 * 指标列表
 * http://192.168.88.247:4999/web/#/203/1588
 * @returns
 */
export function getIndicators (params) {
  return request({
    url: prefixUrl + 'api/v1/data_report/indicators',
    method: 'get',
    params
  })
}

/**
 * 业务列表
 * http://192.168.88.247:4999/web/#/203/1587
 * @returns
 */
export function getLogicList (params) {
  return request({
    url: prefixUrl + 'api/v1/data_report/applications',
    method: 'get',
    params
  })
}

/**
 * http://192.168.88.247:4999/web/#/228/1924
 * @description 获取图表
 */
export function getChartReport (params) {
  return request({
    url: prefixUrl + 'api/v2/data_report/chart/data',
    params
  })
}
/**
 * http://192.168.88.247:4999/web/#/203/1586
 * @description 获取归类ID
 */
export function getDashboardCharts (params) {
  return request({
    url: prefixUrl + 'api/v1/dashboard/2/charts',
    method: 'get',
    params
  })
}
/**
 * @description 根据项目获取渠道
 */
export function getUnionidsbyAppid (params) {
  return request({
    url: prefixUrl + 'api/v1/appinfo/unionids',
    method: 'get',
    params
  })
}
/**
 * http://192.168.88.247:4999/web/#/255/2535
 * @description 获取归类ID
 */
export function getReportDatas (data) {
  return request({
    url: prefixUrl + 'api/v2/data_report/chart/charts_data',
    method: 'post',
    data
  })
}
/**
 * 指标数据
 * http://192.168.88.247:4999/web/#/203/1589
 * @returns
 */
export function getReportDataV2 (params = {}) {
  return request({
    url: prefixUrl + 'api/v2/data_report/chart/data',
    method: 'get',
    params,
    timeout: 0
  })
}
/**
 * 付费排行榜导出
 * http://192.168.88.247:4999/web/#/255/3256
 * @returns
 */
export function createExportTask (data) {
  return request({
    url: prefixUrl + 'api/v1/export',
    method: 'post',
    data
  })
}

/**
 * 导出任务查看
 * http://showdoc.wisetimes.cn:4999/web/#/255/3257
 * @param {*} params
 * @returns
 */
export function queryExportTask (params) {
  return request({
    url: prefixUrl + 'api/v1/export_task',
    method: 'get',
    params
  })
}
